﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DelonixRegoliaHotelManagementSystem;

namespace DelonixRegoliaHotelManagementSystem
{
    public partial class Login : Form
    {
        
        
        public Login()
        {
            InitializeComponent();
            
            
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            
            
            LoginInfo.Username = tbxUsername.Text;
            LoginInfo.Password = tbxPassword.Text;
            Staff m = StaffDBManager.GetStaffByUsername(LoginInfo.Username);
            if (LoginInfo.Password.Equals(m.Password))
            {
                this.Visible = false;
                if (m.Job.Equals("Admin"))
                {
                    AdminForm objAdminForm = new AdminForm();
                    objAdminForm.Show();
                }
                else if (m.Job.Equals("Receptionist"))
                {
                    ReceptionForm objReceptionForm = new ReceptionForm();
                    objReceptionForm.Show();
                }
                else if (m.Job.Equals("Management"))
                {
                    ManagementForm objMgmtForm = new ManagementForm();
                    objMgmtForm.Show();
                }
                
            }
            else
            {
                lblResult.Text = "Login Username or Password is invalid!";
                LoginInfo.Username=null;
                LoginInfo.Password=null;
            }
            
        }
    }
}
